home *** CD-ROM | disk | FTP | other *** search
/ Chip 2003 February / Chip_2003-02_cd1.bin / zkuste / xptools / install / Xsetup / setup.exe / {app} / plugins / XQ WinXP RAS AutoConnect 1.xpl < prev    next >
Text File  |  2002-07-26  |  3KB  |  124 lines

  1. "FILE"="Xteq Systems X-Setup Plugin 6.0"
  2. "TYPE"="9"
  3. "COUNT"="3"
  4. "UIPATH 1"="Network\RAS & DUN"
  5. "UIPATH 2"="Startup/Shutdown\Startup\Windows NT/2K/XP\31) Inside Login Window"
  6. "NAME"="RAS Autoconnect "
  7. "VERSION"="1.00"
  8. "LANGUAGE"="VBScript"
  9. "TEXT 1"="NA NA NA"
  10. "OSVERSION"="000001"
  11. "DESCRIPTION 1"="Windows XP is able to automatically dial a configured RAS (aka DUN) connection on startup."
  12. "DESCRIPTION 2"="This is useful for computers that do not have a normal LAN connection, and only use a dial-in connection for communication."
  13. "DESCRIPTION 3"="It might also be usefull for people that have a flat rate and want to be online as soon as they start the PC."
  14. "DESCRIPTION 4"="A checkbox beside a connection means: Automatically dial this connection. No checkmark means: Do NOT automatically dial this connection."
  15. "AUTHOR"="Xteq Systems"
  16. "CONTACTURL"="http://www.xteq.com"
  17. "COPYRIGHT"="Copyright ⌐ Xteq Systems - All Rights Reserved"
  18. "COMMENT 1"="Based on the setting found by David Chernicoff, david@winnetmag.com"
  19.  
  20.  
  21. sP="HKEY_CURRENT_USER\RemoteAccess\Profile"
  22. sV="AutoConnect"
  23.  
  24.  
  25. dim iItems        'contains the total amount of the registry keys
  26. Dim aryItems()    'contains the name of the Registry paths (direct files starting with ".")
  27. Dim aryItemsLoc() 'contains the registry location  (\ShellNew or \ShellNew-)
  28. Dim aryDesc()     'contains the description of the items
  29.  
  30.  
  31. Sub Plugin_Initialize 
  32.  if RegPathExists(sP) then
  33.     Call ReadRegistry
  34.  else
  35.     Call Disable
  36.  end if
  37. End Sub
  38.  
  39.  
  40. Sub ReadRegistry
  41.     for l=1 to iItems
  42.         Call SetUIElement(l,"")
  43.     next 
  44.  
  45.     iItems=RegEnumPaths(sP) 
  46.  
  47.     ReDim aryItems(iItems)
  48.     ReDim aryDesc(iItems)
  49.  
  50.     l=1
  51.     e=1
  52.  
  53.     sDebug=""
  54.  
  55.     'read all data from the path
  56.     For l=1 to iItems       
  57.         sItem=RegEnumElement(l)    
  58.  
  59.         aryItems(l)=sItem
  60.         aryDesc(l)=sItem 
  61.          
  62.         sDebug=sDebug & sItem
  63.     next
  64.     'Call DebugMsg(sDebug)
  65.  
  66.  
  67.  
  68.     'AND NOW update the UI
  69.     for l=1 to iItems
  70.         Call SetUIElement(l,aryItems(l)) 'set data in X-Setup
  71.         if RegReadValue(sP & "\" & aryItems(l) & "\" & sV)=1 then
  72.            Call SetUIElementEx(l,true)
  73.         end if 
  74.  
  75.     Next
  76. End Sub
  77.  
  78.  
  79.  
  80.  
  81. Sub Plugin_Apply(ElementIndex,ElementSubIndex)
  82.  bChanged=false
  83.  iActivated=0
  84.  
  85.  for l=1 to iItems
  86.      s=sP & "\" & aryItems(l) & "\" & sV
  87.  
  88.      if GetUIElementEx(l)=true then
  89.  
  90.         if RegReadValue(s)<>1 then
  91.            Call RegWriteValue(s,1,2)
  92.            bChanged=true
  93.            iActivated=iActivated+1
  94.         end if     
  95.  
  96.      else
  97.  
  98.         if RegReadValue(s)<>0 then
  99.            Call RegWriteValue(s,0,2)
  100.            bChanged=true
  101.         end if     
  102.  
  103.      end if
  104.  next
  105.  
  106.  if iActivated>1 then
  107.     Call MsgWarning("Notice: You have selected more than one entry for autoconnection. This is possible and can be made, but please note that this should not be done by default. The reason is, that Windows does not exactly know how to route the TCP/IP packages when there are two connection activated at the same time. You should use this configuration only when you are 100% sure what you are doing.")
  108.  end if
  109.          
  110.  if bChanged=true then
  111.     Call Restart
  112.  
  113.     're-read UI
  114.     Call ReadRegistry
  115.  end if
  116.  
  117.  
  118. End Sub
  119.  
  120.  
  121.  
  122. Sub Plugin_Terminate 
  123. End Sub
  124.